<!DOCTYPE html>
<title>Test video buffering properties.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    assert_equals(video.buffered.length, 0);
    assert_throws_dom("IndexSizeError", function() { video.buffered.start(-1); });
    assert_throws_dom("IndexSizeError", function() { video.buffered.end(-1); });
    assert_throws_dom("IndexSizeError", function() { video.buffered.start(0); });
    assert_throws_dom("IndexSizeError", function() { video.buffered.end(0); });

    video.oncanplaythrough = t.step_func_done(function () {
        assert_equals(video.buffered.length, 1);
        assert_equals(video.buffered.start(0), 0);
        assert_greater_than(video.buffered.end(0), 0);
        assert_throws_dom("IndexSizeError", function() { video.buffered.start(-1); });
        assert_throws_dom("IndexSizeError", function() { video.buffered.end(-1); });
        assert_throws_dom("IndexSizeError", function() { video.buffered.start(1); });
        assert_throws_dom("IndexSizeError", function() { video.buffered.end(1); });
    });

    video.src = "content/test.ogv";
});
</script>